package com.panghl.listener;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @Author panghl
 * @Date 2021/6/19 11:10
 * ApplicationListener是Spring事件机制的一部分，与抽象类ApplicationEvent类配合来完成ApplicationContext的事件机制。
 **/
@Component
public class MyApplicationListener implements ApplicationListener<NotifyEvent> {
    @Override
    public void onApplicationEvent(NotifyEvent notifyEvent) {
        System.out.println("获取事件邮箱："+notifyEvent.getEmail());
        System.out.println("获取事件内容："+notifyEvent.getContent());
        System.out.println("MyApplicationListener ...onApplicationEvent");

    }
}
